package com.study.design.pattern.pattern.structural.composite;

/**
 * @Author: gongsl
 * @Date: 2025-03-16 15:20
 * @description:
 */
public class Test {
    public static void main(String[] args) {
        Directory directory = new Directory("Users");
        Directory studyDir = new Directory("学习资料");
        File file = new File("Readme.md");
        Directory videoDir = new Directory("视频资料");
        File javaVideo = new File("java从入门到精通.mp4");
        Directory mdDir = new Directory("专栏资料");
        File patternMd = new File("设计模式.md");

        directory.addSubNode(studyDir);

        studyDir.addSubNode(file);
        studyDir.addSubNode(videoDir);
        studyDir.addSubNode(mdDir);

        videoDir.addSubNode(javaVideo);
        mdDir.addSubNode(patternMd);

        System.out.println(directory.getName() + "目录下文件数量：" + directory.countNumOfFiles());
    }
}
